package leetcode_801_900;

import java.util.*;

public class LeeCode_884 {
    public static void main(String[] args) {

    }
    private static String[] uncommonFromSentences(String s1, String s2) {
        String[] ss1 = s1.split(" ");
        String[] ss2 = s2.split(" ");
        Map<String, Integer> map = new HashMap<>();
        for (String s : ss1) {
            map.put(s, map.getOrDefault(s, 0) + 1);
        }
        for (String s : ss2) {
            map.put(s, map.getOrDefault(s, 0) + 1);
        }
        List<String> list = new ArrayList<>();
        for (String s : map.keySet()) {
            if (map.get(s) == 1){
                list.add(s);
            }
        }
        String[] ans = new String[list.size()];
        for (int i = 0; i < list.size(); i++) {
            ans[i] = list.get(i);
        }
        return ans;
    }
}
